<extend name="Index/index" />
<block name="mycss">
    <!-- <link rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css"> -->
    <link rel="stylesheet" href="__PUBLIC__/my.css">
    <link rel="stylesheet" href="__PUBLIC__/question.css">

</block>

<block name="main">
        <div class="container">
        <div class="row">
        <div class="col-md-7 col-md-offset-1">
            <ul class="nav nav-tabs">
                    <li role="presentation" class="active"><a href="#">为你推荐</a></li>
                    <li role="presentation"><a href="<{:U('Question/hot')}>">全站热门</a></li>
<!--                     <li role="presentation"><a href="<{:U('Question/invited')}>">邀请回答</a></li> -->
            </ul>

            <div class="tuijian">
            <for start="0" end="count($row)">
            <nav>
                  <ul class="pager fl ">
                    <li><a href="<{:U('Topics/detail','tid='.$row[$i]['id'])}>"><{$row[$i]['name']}></a></li>
                  </ul>
                </nav>
            </for>
            </div>
            <div class="mt10 cb">
                <!-- <form action="">
                    <input type="text" placeholder="添加擅长话题">
                </form> -->
            </div>
            <div class="went mt20">
                <div class="fl">根据你的擅长话题，推荐以下问题</div>
                <div class="fr">
                        <a class="remen">热门问题</a>
                        <span class="ccc">|</span>
                        <a  class="quanbu">全部问题</a>
                </div>
            </div>
            <div class='titi'>
            <for start="0" end="count($list)">
                <div class="went1" bh="<{$list[$i]['id']}>">
                    <div>
                    <div  class="fl">来自:<a href="<{:U('Topics/detail')}>?tid=<{$list[$i]['topic_id']}>"><{$list[$i]['topic_name']}></a>
                    </div>
                    <div class="fr chacha">×</div>
                    </div>
                    <div class="mt10 hjhj cb"><b><a href="<{:U('Question/detail','qid='.$list[$i]['id'])}>"><{$list[$i]['name']}></b></a>
                    </div>
                    <div class="mt10"><{$list[$i]['answer_num']}>个回答<b>·</b><{$list[$i]['attend_num']}>人关注</div>
                    <div class="mt10"></div>
                </div>
                </for>
            </div>
        </div>

        <div class="col-md-3">
            <!-- <div class="tuijian2 bgc">121</div> -->
            <div class="h6 rightshow">
                        <a href="<{:U('Index/index')}>"  style="color:#888"><span class="glyphicon glyphicon-home"></span>&nbsp;&nbsp;知乎首页</a>

                        <a href="<{:U('Collections/index')}>"  style="color:#888"><span class="glyphicon glyphicon-bookmark"></span>&nbsp;&nbsp;我的收藏</a>

                        <a href="<{:U('Question/following')}>"  style="color:#888"><span class="glyphicon glyphicon-check"></span>&nbsp;&nbsp;我关注的问题</a>

                        <a href="<{:U('Topics/index')}>" style="color:#888"><span class="glyphicon glyphicon-th-large"></span>&nbsp;&nbsp;话题广场</a>

                    </div>

                    <h5 class="mt30"> <b><img src="__PUBLIC__/images/2016-07-21_141413.jpg">&nbsp;&nbsp;知乎专栏</b> </h5>
                    <div class="h6 rightshow">
                        <a href="<{:U('Explore/index')}>"  style="color:#888">发现</a>
                        <a href="<{:U('Article/index')}>"  style="color:#888">文章</a>
                    </div>
                    <div >© 2016 知乎</div>
        </div>
        </div>
        </div>
</body>

</block>

<block name="myjs">

<script>
    $(function(){
        $('#try tr td').mouseover(function(){
            $(this).children().css("color","#225599");
            $(this).children().css("color","#225599");
        })
        $('#try tr td').mouseout(function(){
            $(this).children().css('color','#666');
            $(this).children().css("color","#666");
        })
        $('.chacha').mouseover(function(){
            $(this).css('cursor','pointer');
        })
        $('.chacha').click(function(){
            $(this).parent().parent().slideUp("1000");
            var id = $(this).parent().parent().attr('bh');
            $.ajax({
                type:'get',
                url:"<{:U('Home/Question/xiaoshi')}>"+'?id='+id,
            });
        })
        $('.remen').mouseover(function(){
            $(this).css('cursor','pointer');
        })

        $('.remen').click(function(){    
            $.ajax({
                type:'get',
                url:"<{:U('Home/Question/remen')}>",
                success:function(queen){
                    $('.titi').empty();
                    for(var y in queen)
                    {
                        $('.titi').append('<div class="went1" bh="'+queen[y]['id']+'">\
                    <div>\
                    <div class="fl">来自:<a href="/Home/Topics/detail/tid/'+queen[y]['topic_id']+'">'+queen[y]['topic_name']+'</a>\
                    </div>\
                    <div class="fr chacha" onclick="mm(this)" onmouseover="nn(this)">×</div>\
                    </div>\
                    <div class="mt10 hjhj cb"><b><a href="/Home/Question/detail/qid/'+queen[y]['id']+'">'+queen[y]['name']+'</a></b>\
                    </div>\
                    <div class="mt10">'+queen[y]['answer_num']+'个回答<b>·</b>'+queen[y]['attend_num']+'人关注</div>\
                    <div class="mt10"></div>\
                </div>');
                    }
                }
            });
        })

        $('.quanbu').mouseover(function(){
            $(this).css('cursor','pointer');
        })



        $('.quanbu').click(function(){    
            $.ajax({
                type:'get',
                url:"<{:U('Home/Question/quanbu')}>",
                success:function(data){
                    $('.titi').empty();
                    for(var x in data)
                    {
                        $('.titi').append('<div class="went1" bh="'+data[x]['id']+'">\
                    <div>\
                    <div class="fl">来自:<a href="/Home/Topics/detail/tid/'+data[x]['topic_id']+'">'+data[x]['topic_name']+'</a>\
                    </div>\
                    <div class="fr chacha" onclick="mm(this)" onmouseover="nn(this)">×</div>\
                    </div>\
                    <div class="mt10 hjhj cb"><b><a href="/Home/Question/detail/qid/'+data[x]['id']+'">'+data[x]['name']+'</a></b>\
                    </div>\
                    <div class="mt10">'+data[x]['answer_num']+'个回答<b>·</b>'+data[x]['attend_num']+'人关注</div>\
                    <div class="mt10"></div>\
                </div>');
                    }
                }
            });
        })
    })
function mm(data){
$id = data.parentNode.parentNode.getAttribute('bh');
        var xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function (){
            console.log(xhr.readyState);
            if (xhr.status == 200 && xhr.readyState == 4) {
                console.log('xhr.responseText');
            }
        }
        //请求初始化
        xhr.open('get',"<{:U('Home/Question/xiaoshi')}>?id="+$id,true);
        //正式发送请求
        xhr.send();
        data.parentNode.parentNode.parentNode.removeChild(data.parentNode.parentNode);
}
function nn(dds){
dds.style.cursor='pointer';
}
</script>
</block>